<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title>BUG详情</title>
	<link rel="icon" href="../../img/icon.png" type="image/x-icon"/>  
	<link rel="stylesheet" type="text/css" href="../../css/app.css"/>
	<link rel="stylesheet" type="text/css" href="../../css/index.css"/>
</head>
<body>
<!-- 顶部菜单 -->
<ul id="top">
	<li class="addBug back" onclick="mui.back();">返回</li>
	<li class="addBug">BUG处理</li>
	<li class="addBug back">&nbsp;</li>
</ul>
<!-- 数据详情 -->
<!-- <div style="height: 20px;"></div> -->
<table cellspacing="0" class="bugShow">
	<tr>
		<th colspan="2">
			<h2 id="bugName">BUG标题</h2>
		</th>
	</tr>
	<tr>
		<td class="tl">问题描述：</td>
		<td id="bugDetail">&nbsp;</td>
	</tr>
	<tr>
		<td class="tl">问题链接：</td>
		<td id="bugLink">&nbsp;</td>
	</tr>
	<tr>
		<td class="tl">问题图片：</td>
		<td id="bugImgs">&nbsp;</td>
	</tr>
	<tr>
		<td class="tl">发布时间：</td>
		<td id="createTime">&nbsp;</td>
	</tr>
	<tr>
		<td class="tl">发布人：</td>
		<td id="adminName">&nbsp;</td>
	</tr>
	<tr>
		<td class="tl">问题状态：</td>
		<td id="statusName">&nbsp;</td>
	</tr>
	<tr>
		<td class="tl">指定人：</td>
		<td id="almName">&nbsp;</td>
	</tr>
</table>
<div style="height: 50px;"></div>
<table cellspacing="0" class="bugShow">
	<tr>
		<th colspan="2">
			BUG处理跟踪
			<span style="color:#FF4466;">
				【0】
			</span>
		</th>
	</tr>
</table>
<span id="datalist">
	<table cellspacing="0" class="bugShow">
		<tr>
			<td class="tl">序号：</td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td class="tl">解决人：</td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td class="tl">解决估时：</td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td class="tl">解决描述：</td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td class="tl">解决预览：</td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td class="tl">遗留问题：</td>
			<td>&nbsp;</td>
		</tr>
	</table>
</span>
<div style="height: 50px;"></div>
<!-- 底部菜单 -->
<ul id="foot">
	<li onclick="jumpToIndex()">BUG</li>
	<li class="noclick" onclick="jumpToHistory()">历史</li>
	<li class="noclick" onclick="jumpToMore()">更多</li>
	<li class="noclick" onclick="jumpToMy()">我的</li>
</ul>
</body>
</html>


<script type="text/javascript" src="../../js/mui.min.js"></script>
<script type="text/javascript" src="../../js/app.js"></script>
<script type="text/javascript">
	var domain = getDomain();
	var token = getAdminToken();
	var bugId = getUrlParam('bugId');
	//自动加载
	(function($, owner) {
		getBugOne();
		getDealList()
	}(mui, window.app = {}));
	//获取BUG详情
	function getBugOne(){
		mui.toast('加载中...',{ 
			duration:'long', type:'div',
		});
		mui.ajax(domain+'/app/bug/one',{
			data:{
				token:token,
				bugId:bugId
			},
			dataType:'json',//服务器返回json格式数据
			type:'post',//HTTP请求类型
			timeout:10000,//超时时间设置为10秒；
			// headers:{'Content-Type':'application/json'},
			headers:{'Content-Type':'application/x-www-form-urlencoded'}, 
			async: true,  //async: true || false, // 异步 || 同步
			crossDomain: true,  //强制跨域
			success:function(res){
				console.log(res);
				if (res.code!=0) {
					mui.toast(res.msg+'！',{ 
						duration:'long', type:'div',
					});
					return
				}
				var datalist = res.data;
				mui("#bugName")[0].innerHTML = datalist.bugName;
				mui("#bugLink")[0].innerHTML = datalist.bugLink;
				mui("#createTime")[0].innerHTML = datalist.createTime;
				mui("#bugDetail")[0].innerHTML = datalist.bugDetail;
				mui("#adminName")[0].innerHTML = datalist.adminName;
				mui("#almName")[0].innerHTML = datalist.almName;
				mui("#statusName")[0].innerHTML = datalist.statusName;
				//问题图片
				// mui("#bugImgs")[0].innerHTML = datalist.bugLink;
			},
			error:function(xhr,type,errorThrown){
				// console.log('网络错误');
				mui.toast(xhr+type+'网络错误！',{ 
					duration:'long', type:'div',
				});
			}
		});
	}
	//跟踪加载
	function getDealList(){
		// mui.toast('跟踪加载中...',{ 
		// 	duration:'long', type:'div',
		// });
		mui.ajax(domain+'/app/bug/deal/index',{
			data:{
				token:token,
				bugId:bugId
			},
			dataType:'json',//服务器返回json格式数据
			type:'post',//HTTP请求类型
			timeout:10000,//超时时间设置为10秒；
			// headers:{'Content-Type':'application/json'},
			headers:{'Content-Type':'application/x-www-form-urlencoded'}, 
			async: true,  //async: true || false, // 异步 || 同步
			crossDomain: true,  //强制跨域
			success:function(res){
				console.log(res);
				if (res.code!=0) {
					mui.toast(res.msg+'！',{ 
						duration:'long', type:'div',
					});
					return
				}
				var datalist = res.data;
				var i, i2, list = '';
				for (i=0;i<datalist.length;i++) {
					var serial = i * 1 + 1;  //序号
					list += '<table cellspacing="0" class="bugShow">';
					list += '<tr>';
					list += '<td class="tl">序号：</td>';
					list += '<td>'+serial+'</td>';
					list += '</tr>';
					list += '<tr>';
					list += '<td class="tl">解决人：</td>';
					list += '<td>'+datalist[i].dealName+'</td>';
					list += '</tr>';
					list += '<tr>';
					list += '<td class="tl">解决估时：</td>';
					list += '<td>'+datalist[i].almTime+'</td>';
					list += '</tr>';
					list += '<tr>';
					list += '<td class="tl">解决描述：</td>';
					list += '<td>'+datalist[i].dealDetail+'</td>';
					list += '</tr>';
					list += '<tr>';
					list += '<td class="tl">解决图片：</td>';
					//解决图片
					if (datalist[i].imgCount==0) {
						list += '<td>没有图片</td>';
					} else {
						list += '<td class="btn" onclisk="jumpToImgList()">点击详情</td>';
					}
					list += '</tr>';
					list += '<tr>';
					list += '<td class="tl">遗留问题：</td>';
					list += '<td>'+datalist[i].leave+'</td>';
					list += '</tr>';
					list += '</table>';
				}
				mui("#datalist")[0].innerHTML = list;
			},
			error:function(xhr,type,errorThrown){
				// console.log('网络错误');
				mui.toast(xhr+type+'网络错误！',{ 
					duration:'long', type:'div',
				});
			}
		});
	}
</script>